SELECT
r.session_id,
r.status,
r.command,
r.cpu_time,
r.total_elapsed_time,
t.text
FROMsys.dm_exec_requests AS r
CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) AS t
How to get list of active queries in SQL Server
Seyed Hamed Vahedi
Tue, 19 December, 2023